Backend robustness fixes + module/component refactors (from a code review)#1307
Open
SandeepSubba wants to merge 3 commits into
Open
Backend robustness fixes + module/component refactors (from a code review)#1307SandeepSubba wants to merge 3 commits into
SandeepSubba wants to merge 3 commits into
Conversation
- cache_utils: hash full AI-patch base64 content instead of string length in calculate_transform_hash, so two distinct patch results of identical dimensions can no longer collide and leave a stale patch composited. - ai_processing: validate AI model output tensor shapes before indexing (SAM decoder, sky-seg, U-2-Netp, Depth-Anything, LaMa). A model whose output resolution differs from the hardcoded assumption now returns a clean error instead of panicking on out-of-bounds access. - export_processing: bounds-check the frontend-supplied mask_index and guard calculate_resize_target against zero-dimension images (was Inf/NaN). - lib: cap lut_cache at 32 entries; it is keyed by path and never cleared by the session/image cache resets, so it previously grew unbounded. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Move the seven self-contained widget components (KeybindRow, SettingItem, DataActionItem, AiProviderSwitch, CloudDashboard, CanvasInputModeSwitch, PreviewModeSwitch) into src/components/panel/settings/widgets.tsx and prune the now-dead imports. These widgets touch no parent state, so the cut is mechanical. SettingsPanel.tsx drops from ~2415 to ~2032 lines. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Peel cohesive clusters out of two oversized Rust files into sibling submodules, each using `use super::*` to inherit the parent's imports and re-exported via `pub use` so the existing command paths in lib.rs are unchanged: - file_management/albums.rs (AlbumItem + album commands, ~260 lines) - file_management/folder_tree.rs (FolderNode + lazy dir scanning, ~270 lines) - image_processing/analysis.rs (histogram/waveform/auto-adjust, ~710 lines) file_management.rs 3661 -> 3135, image_processing.rs 3262 -> 2555. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
SandeepSubba
force-pushed
the
code-analysis-fixes
branch
from
June 26, 2026 04:25
f58799c to
75f7fef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This branch came out of a code-analysis pass over RapidRAW. Three commits,
each scoped to one concern.
1. Backend correctness & robustness (
fix:)calculate_transform_hashhashedeach AI patch by base64 string length instead of content, so two
different patch results of identical dimensions could collide and leave
the old patch composited. Now hashes the actual content.
Depth-Anything, and LaMa paths indexed model output assuming an exact
tensor shape and
.unwrap()-ed. A model whose output resolution differsnow returns a clean error instead of panicking.
mask_index; guardcalculate_resize_targetagainst zero-dimension images (was Inf/NaN).session/image resets, so it grew unbounded — now capped at 32 entries.
2. Extract SettingsPanel widgets (
refactor:)Move 7 self-contained presentational components into
components/panel/settings/widgets.tsx.SettingsPanel.tsx2415 → 2032 lines.3. Split two oversized Rust files (
refactor:)Peel cohesive clusters into submodules (
use super::*+pub use, so thecommand paths in
lib.rsare unchanged):file_management/albums.rs,file_management/folder_tree.rsimage_processing/analysis.rsfile_management.rs3661 → 3135,image_processing.rs3262 → 2555.Verification
cargo check— clean (no errors/warnings).npm run typecheck— clean.These are deliberately small, self-contained changes; happy to split into
separate PRs or adjust anything if it doesn't fit your direction.